//
//  AuthenCompanyMsgModel.swift
//  kxf
//
//  Created by Mac on 2024/3/17.
//

import Foundation


class AuthenCompanyMsgModel {
    
    //主键
    var tel = ""
    var merchantType = "0"
    
    //MARK: 商户信息
    var posChannel = "ys"
    var photoImgUrlLicence = ""
    
    var mchName = ""//商户全称
    var mchNameSimple = ""//商户简称
    var licenseNo = ""
    var licenseStartTime = ""
    var licenseEndTime = ""
    var licenseArea = ""//经营范围
    var licenseAddress = ""
    
    var money = ""
    var mercMccCode    = ""
    var mercMccName = ""
    var mercAlipayMccCode = ""
    var mercAlipayMccName = ""
    var mercAlipayMcc = ""
    var mercWeChatMccCode = ""
    var mercWeChatMccName = ""
    var mercWeChatMcc = ""
    //地区码
    var addressProvinceCode = ""
    var addressProvinceName = ""
    var addressCityCode = ""
    var addressCityName = ""
    var addressAreaCode = ""
    var addressAreaName = ""
    var placeCode = ""
    var placeCodeText = ""
    var email = ""
    var remark = ""
    
    //MARK: 法人信息
    var photoImgUrlIdCardFront = ""
    var photoImgUrlIdCardBack  = ""
    var photoImgUrlIdCardInhand = ""
    var legalName = ""
    var legalIdCardNo = ""
    var legalIdCardStartTime = ""
    var legalIdCardEndTime = ""
    var legalAddress = ""
     
    //MARK: 结算信息
    var photoImgUrlBankCardFront = ""
    var photoImgUrlBankKaiHuXuKe = ""
    var photoImgUrlBankZhuanZhang = ""
    var photoImgUrlBankOther = ""
    var settleName = ""
    var settleBankNo = ""
    var settleWay = ""//结算对象   法人、非法人
    var settleWayName = ""
    var settleBankType = ""//账户结算类型
    var settleBankTypeName = ""
    var settleBankNamePrivate = ""//对私银行名称
    var settleBankBranchCodePrivate = ""//对私开户支行
    var settleBankBranchNamePrivate = ""
    var settleBankPhone = ""
    var settleBankNoPublic = ""//对公银行账号
    var settleBankNamePublic = ""//对公银行名称
    var settleBankBranchCodePublic = ""//对公银行开户行
    var settleBankBranchNamePublic = ""
    
    //MARK: 门店信息
    var photoImgUrlMenTou = ""
    var photoImgUrlDianNei = ""
    var photoImgUrlCash   = ""
    var photoImgUrlDianWai = ""
    var photoImgUrlLocation = ""
    var otherAttachment    = ""
    var mercName = ""
    var mercContactName = ""
    var mercContactPhone = ""
    var mercAddress = ""
    //省市区
    var mercAddressProvinceCode = ""
    var mercAddressProvinceName = ""
    var mercAddressCityCode = ""
    var mercAddressCityName = ""
    var mercAddressAreaCode = ""
    var mercAddressAreaName = ""
    var mercPlaceCode = ""
    var mercPlaceCodeText = ""
    
    //非法人结算信息
//    var settleType = "LEGAL_PERSON" // LEGAL_PERSON  法人结算  UNINCORPORATE  非法人结算
    var unincorporateIdCardFrontImage = ""
    var unincorporateIdCardBackImage = ""
    var unincorporateHandheldIdCard = ""
    var unincorporateBankCardImage = ""
    var unincorpoProofMchntImg = ""//结算证明
    
    var unincorporateIdCardName = ""
    var unincorporateIdCardNo = ""
    var unincorporateIdCardStartDate = ""
    var unincorporateIdCardEndDate = ""
    var unincorporateCardNo = ""
//    var unincorporateBank = ""//结算银行
    var unincorporateBankName = ""//结算银行名称
    var unincorporateBankNo = ""//结算支行联行号
    var unincorporateBankTel = ""
//    var unincorporateBankName = ""
    
    
    
    static let shareInstance = AuthenCompanyMsgModel()
    
    private init(){
        
    }
    
    func dealAddressToPlaceCode() {
        self.addressProvinceName = AddressModel.shareInstance.addressProvinceName
        self.addressProvinceCode = AddressModel.shareInstance.addressProvinceCode
        self.addressCityName = AddressModel.shareInstance.addressCityName
        self.addressCityCode = AddressModel.shareInstance.addressCityCode
        self.addressAreaCode = AddressModel.shareInstance.addressAreaCode
        self.addressAreaName = AddressModel.shareInstance.addressAreaName
        
        self.placeCode = "\(self.addressProvinceName)\(self.addressCityName)\(self.addressAreaName)_\(self.addressProvinceCode)_\(self.addressCityCode)_\(self.addressAreaCode)"
        self.placeCodeText = "\(self.addressProvinceName)\(self.addressCityName)\(self.addressAreaName)"
    }
    func clearAddressMsg(){
        self.addressProvinceName = ""
        self.addressProvinceCode = ""
        self.addressCityName = ""
        self.addressCityCode = ""
        self.addressAreaName = ""
        self.addressCityCode = ""
    }
    func dealAddressToPlaceCodeForMarket() {
        self.mercAddressProvinceName = AddressModel.shareInstance.addressProvinceName
        self.mercAddressProvinceCode = AddressModel.shareInstance.addressProvinceCode
        self.mercAddressCityName = AddressModel.shareInstance.addressCityName
        self.mercAddressCityCode = AddressModel.shareInstance.addressCityCode
        self.mercAddressAreaCode = AddressModel.shareInstance.addressAreaCode
        self.mercAddressAreaName = AddressModel.shareInstance.addressAreaName
        
        self.mercPlaceCode = "\(self.mercAddressProvinceName)\(self.mercAddressCityName)\(self.mercAddressAreaName)_\(self.mercAddressProvinceCode)_\(self.mercAddressCityCode)_\(self.mercAddressAreaCode)"
        self.mercPlaceCodeText = "\(self.mercAddressProvinceName)\(self.mercAddressCityName)\(self.mercAddressAreaName)"
    }
    func clearAddressMsgForMarket(){
        self.mercAddressProvinceName = ""
        self.mercAddressProvinceCode = ""
        self.mercAddressCityName = ""
        self.mercAddressCityCode = ""
        self.mercAddressAreaName = ""
        self.mercAddressAreaCode = ""
    }
    
    func refreshMsg(dict:NSDictionary) {
        self.tel = dict["tel"]as? String ?? ""
        self.posChannel = dict["posChannel"]as? String ?? ""
        self.photoImgUrlLicence = dict["licensePic"]as? String ?? ""
        self.mchName = dict["mchName"]as? String ?? ""
        self.mchNameSimple = dict["name"]as? String ?? ""
        self.merchantType = dict["merchantType"]as? String ?? ""
        self.money = dict["registeredCapital"]as? String ?? ""
        self.licenseNo = dict["licenseNo"]as? String ?? ""
        self.licenseStartTime = dict["licenseStart"]as? String ?? ""
        self.licenseEndTime = dict["licenseEnd"]as? String ?? ""
        self.mercMccCode = dict["mcc"]as? String ?? ""
        self.mercMccName = dict["industryTypeOne"]as? String ?? ""
        self.mercAlipayMcc = dict["aliPayMcc"]as? String ?? ""
        self.mercAlipayMccName = dict["industryAliPay"]as? String ?? ""
        self.mercWeChatMcc = dict["wechatMcc"]as? String ?? ""
        self.mercWeChatMccName = dict["wechatMcc"] as? String ?? ""//dict["industryWechat"]as? String ?? ""
        self.licenseAddress = dict["merchantAddress"]as? String ?? ""
        self.email = dict["email"]as? String ?? ""
        self.licenseArea = dict["businessScope"]as? String ?? ""
        self.remark = dict["remark"]as? String ?? ""
        self.photoImgUrlIdCardFront = dict["shenfengzhengpic"]as? String ?? ""
        self.photoImgUrlIdCardBack = dict["shenfengfanpic"]as? String ?? ""
        self.photoImgUrlIdCardInhand = dict["holdingCardPic"]as? String ?? ""
        self.legalName = dict["xinming"]as? String ?? ""
        self.legalIdCardNo = dict["shenfengid"]as? String ?? ""
        self.legalIdCardStartTime = dict["shenfengbegindate"]as? String ?? ""
        self.legalIdCardEndTime = dict["shenfengenddate"]as? String ?? ""
        self.legalAddress = dict["lawyerAddress"]as? String ?? ""
        self.photoImgUrlBankCardFront = dict["bankcardpic"]as? String ?? ""
        self.photoImgUrlBankKaiHuXuKe = dict["bankPassPic"]as? String ?? ""
        self.photoImgUrlBankZhuanZhang = dict["transferApplyAttachment"]as? String ?? ""
        self.photoImgUrlBankOther = dict["mchContractPic"]as? String ?? ""
        self.settleBankNo = dict["bankcardid"]as? String ?? ""
        self.settleBankType = dict["accBankType"]as? String ?? ""
        
        if dict["accBankType"]as? String ?? "" == "1"{
            self.settleBankTypeName = "对公账户"
        }else if dict["accBankType"]as? String ?? "" == "2"{
            self.settleBankTypeName = "对私账户"
        }else{
            self.settleBankTypeName = dict["accBankTypeText"]as? String ?? ""
        }
        
        self.settleWay = dict["settleWay"]as? String ?? ""
        if dict["settleWay"]as? String ?? "" == "UNINCORPORATE"{
            self.settleWayName = "非法人"
        }else{
            self.settleWayName = "法人"
        }
        
        self.settleBankNamePrivate = dict["bankName"]as? String ?? ""
        self.settleBankBranchNamePrivate = dict["openingBank"]as? String ?? ""
        self.settleBankPhone = dict["bankTel"]as? String ?? ""
        self.settleBankNoPublic = dict["corporateAccount"]as? String ?? ""
        self.settleBankNamePublic = dict["corporateBankName"]as? String ?? ""
        self.settleBankBranchNamePublic = dict["corporateBranchName"]as? String ?? ""
        self.photoImgUrlMenTou = dict["shopHeadPic"]as? String ?? ""
        self.photoImgUrlDianNei = dict["shopOnPic"]as? String ?? ""
        self.photoImgUrlCash = dict["shopCashPic"]as? String ?? ""
        self.photoImgUrlDianWai = dict["shopOutPic"]as? String ?? ""
        self.photoImgUrlLocation = dict["otherAttachment"]as? String ?? ""
        self.mercName = dict["shopName"]as? String ?? ""
        self.mercContactName = dict["shopUserName"]as? String ?? ""
        self.mercContactPhone = dict["shopPhone"]as? String ?? ""
        self.mercAddress = dict["shopAddress"]as? String ?? ""
        self.addressProvinceCode = dict["placeProvinceCode"]as? String ?? ""
        self.addressProvinceName = dict["placeProvinceName"]as? String ?? ""
        self.addressCityCode = dict["placeCityCode"]as? String ?? ""
        self.addressCityName = dict["placeCityName"]as? String ?? ""
        self.addressAreaName = dict["placeAreaName"]as? String ?? ""
        self.addressAreaCode = dict["placeAreaCode"]as? String ?? ""
        self.mercAddressProvinceCode = dict["shopProvinceCode"]as? String ?? ""
        self.mercAddressProvinceName = dict["shopProvinceName"]as? String ?? ""
        self.mercAddressCityCode = dict["shopCityCode"]as? String ?? ""
        self.mercAddressCityName = dict["shopCityName"]as? String ?? ""
        self.mercAddressAreaCode = dict["shopAreaCode"]as? String ?? ""
        self.mercAddressAreaName = dict["shopAreaName"]as? String ?? ""
        
        self.placeCode = "\(self.addressProvinceName)\(self.addressCityName)\(self.addressAreaName)_\(self.addressProvinceCode)_\(self.addressCityCode)_\(self.addressAreaCode)"
        self.placeCodeText = "\(self.addressProvinceName)\(self.addressCityName)\(self.addressAreaName)"
        self.mercPlaceCode = "\(self.mercAddressProvinceName)\(self.mercAddressCityName)\(self.mercAddressAreaName)_\(self.mercAddressProvinceCode)_\(self.mercAddressCityCode)_\(self.mercAddressAreaCode)"
        self.mercPlaceCodeText = "\(self.mercAddressProvinceName)\(self.mercAddressCityName)\(self.mercAddressAreaName)"
        
        
        self.unincorporateBankCardImage = dict["unincorporateBankCardImage"]as? String ?? ""
//        self.unincorporateBank = dict["unincorporateBankName"]as? String ?? ""
        self.unincorporateBankName = dict["unincorporateBankName"]as? String ?? ""
        self.unincorporateBankNo = dict["unincorporateBankNo"]as? String ?? ""
        self.unincorporateBankTel = dict["unincorporateBankTel"]as? String ?? ""
        self.unincorporateCardNo = dict["unincorporateCardNo"]as? String ?? ""
        self.unincorporateHandheldIdCard = dict["unincorporateHandheldIdCard"]as? String ?? ""
        self.unincorporateIdCardBackImage = dict["unincorporateIdCardBackImage"]as? String ?? ""
        self.unincorporateIdCardEndDate = dict["unincorporateIdCardEndDate"]as? String ?? ""
        self.unincorporateIdCardFrontImage = dict["unincorporateIdCardFrontImage"]as? String ?? ""
        self.unincorporateIdCardName = dict["unincorporateIdCardName"]as? String ?? ""
        self.unincorporateIdCardNo = dict["unincorporateIdCardNo"]as? String ?? ""
        self.unincorporateIdCardStartDate = dict["unincorporateIdCardStartDate"]as? String ?? ""
        self.unincorpoProofMchntImg = dict["proofMchntImg"]as? String ?? ""
        
    }
}

